package com.saumya.robotlegs
{
	import com.saumya.robotlegs.controller.BeginFileSearchCommand;
	import com.saumya.robotlegs.controller.CreateBatchFilesCommand;
	import com.saumya.robotlegs.controller.PublishAllCommand;
	import com.saumya.robotlegs.controller.PublishOneBatchCommand;
	import com.saumya.robotlegs.events.ApplicationStartEvent;
	import com.saumya.robotlegs.events.FileSearchEvent;
	import com.saumya.robotlegs.events.JSFLCreationEvent;
	import com.saumya.robotlegs.events.PublishEvent;
	import com.saumya.robotlegs.model.JsflModel;
	import com.saumya.robotlegs.model.SearchedFilesModel;
	import com.saumya.robotlegs.view.BaseUI;
	import com.saumya.robotlegs.view.BaseUIMediator;
	import com.saumya.robotlegs.view.IntroView;
	import com.saumya.robotlegs.view.IntroViewMediator;
	import com.saumya.robotlegs.view.LoggerView;
	import com.saumya.robotlegs.view.LoggerViewMediator;
	import com.saumya.robotlegs.view.SaumyaPublishUIMediator;
	
	import org.robotlegs.mvcs.Context;
	
	import spark.components.SkinnableContainer;

	public class SaumyaPublishContext extends Context
	{
		public function SaumyaPublishContext()
		{
			super();
		}
		
		public override function startup():void
		{
			///////////////////All mapping////////////////
			//view maps
			this.mediatorMap.mapView(SaumyaPublishUI,SaumyaPublishUIMediator);
			this.mediatorMap.mapView(IntroView,IntroViewMediator);
			this.mediatorMap.mapView(LoggerView,LoggerViewMediator);
			this.mediatorMap.mapView(BaseUI,BaseUIMediator);
			//controller/command maps
			this.commandMap.mapEvent(FileSearchEvent.BEGIN_SEARCH,BeginFileSearchCommand,FileSearchEvent);
			this.commandMap.mapEvent(JSFLCreationEvent.BEGIN_BATCH_CREATION,CreateBatchFilesCommand,JSFLCreationEvent);
			this.commandMap.mapEvent(PublishEvent.PUBLISH_BATCH,PublishOneBatchCommand,PublishEvent);
			this.commandMap.mapEvent(PublishEvent.PUBLISH_ALL,PublishAllCommand,PublishEvent);
			//model injectors
			this.injector.mapSingleton(SearchedFilesModel);
			this.injector.mapSingleton(JsflModel);
			
			//Add initial view to stage, incase you need to
			/**
			 *Example :
			 * var myView:SkinnableContainer=contextView as SkinnableContainer;
			 * myView.addElement(new HomeView()); 
			 **/
			//var myView:SkinnableContainer=this.contextView as SkinnableContainer;
			//myView.addElement(new IntroView());
			//last call
			super.startup();
		}
		
	}
}